Other Changes
~~~~~~~~~~~~~
-- ``dnp3`` has reduced the default maximum number of outstanding
- transactions from 500 down to 32. A ``max-tx`` parameter has been
- added to the ``dnp3`` parser for users that need a larger number of
- in-flight transactions.
+- ``dnp3`` has reduced the maximum number of open transactions from
+ 500 down to 32, and the maximum number of points per message from
+ unbounded to 16384. Configuration options, ``max-tx`` and
+ ``max-points`` have been added for users who may need to change
+ these defaults.
Upgrading to 7.0.9
------------------
* attacks. */
static uint64_t dnp3_max_tx = 32;
+/* The maximum number of points allowed per message (configurable). */
+static uint64_t max_points = 16384;
+
/* Decoder event map. */
SCEnumCharMap dnp3_decoder_event_table[] = {
- {"FLOODED", DNP3_DECODER_EVENT_FLOODED},
- {"LEN_TOO_SMALL", DNP3_DECODER_EVENT_LEN_TOO_SMALL},
- {"BAD_LINK_CRC", DNP3_DECODER_EVENT_BAD_LINK_CRC},
- {"BAD_TRANSPORT_CRC", DNP3_DECODER_EVENT_BAD_TRANSPORT_CRC},
- {"MALFORMED", DNP3_DECODER_EVENT_MALFORMED},
- {"UNKNOWN_OBJECT", DNP3_DECODER_EVENT_UNKNOWN_OBJECT},
- {NULL, -1},
+ { "FLOODED", DNP3_DECODER_EVENT_FLOODED },
+ { "LEN_TOO_SMALL", DNP3_DECODER_EVENT_LEN_TOO_SMALL },
+ { "BAD_LINK_CRC", DNP3_DECODER_EVENT_BAD_LINK_CRC },
+ { "BAD_TRANSPORT_CRC", DNP3_DECODER_EVENT_BAD_TRANSPORT_CRC },
+ { "MALFORMED", DNP3_DECODER_EVENT_MALFORMED },
+ { "UNKNOWN_OBJECT", DNP3_DECODER_EVENT_UNKNOWN_OBJECT },
+ { "TOO_MANY_POINTS", DNP3_DECODER_EVENT_TOO_MANY_POINTS },
+ { NULL, -1 },
};
/* Calculate the next transport sequence number. */
uint32_t len, DNP3ObjectList *objects)
{
int retval = 0;
+ uint64_t point_count = 0;
if (buf == NULL || len == 0) {
return 1;
goto next;
}
+ /* Check if we've exceeded the maximum number of points per message. */
+ point_count += object->count;
+ if (point_count > max_points) {
+ DNP3SetEventTx(tx, DNP3_DECODER_EVENT_TOO_MANY_POINTS);
+ goto done;
+ }
+
int event = DNP3DecodeObject(header->group, header->variation, &buf,
&len, object->prefix_code, object->start, object->count,
object->points);
if (ConfGetInt("app-layer.protocols.dnp3.max-tx", &value)) {
dnp3_max_tx = (uint64_t)value;
}
+
+ /* Parse max-points configuration. */
+ if (ConfGetInt("app-layer.protocols.dnp3.max-points", &value)) {
+ if (value > 0) {
+ max_points = (uint64_t)value;
+ }
+ }
} else {
SCLogConfig("Parser disabled for protocol %s. "
"Protocol detection still on.", proto_name);